<template>
  <div class="list-hot-layout">
    <ul class="list-hot-list">
      <template v-for="(item, index) in goodsList">
        <li class="list-hot-item" :class="index % 4 == 3 ? 'mag-0' : 'mag-10'" :key="item" 
          @click="goGoods(item)">
          <img
            class="img"
            :src="item.coverImg"
          />
          <div class="list-hot-item-name">{{item.name}}</div>
          <div class="list-hot-item-desc">{{item.description}}</div>
          <div class="list-hot-item-price">
            <span class="price-currency">¥</span>
            <span class="price-amount">{{item.price}}</span>
            <span class="price-from">起</span>
          </div>
        </li>
      </template>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    goodsList: Array
  },
  methods: {
    goGoods(item) {
      console.log(item);
      this.$router.push({
        name: 'goods',
        query: {
          projectId: item.id
        }
      })
    }
  }
};
</script>

<style lang="less" scoped>
  .list-hot-layout {
    background: #f4f9ff;
    width: 1190px;
    margin: auto;
    margin-top: 20px;

    .list-hot-list {
      display: flex;
      flex-wrap: wrap;
    }

    .list-hot-item {
      cursor: pointer;
      display: flex;
      align-items: center;
      flex-direction: column;
      width: 290px;
      background: #fff;
      
      &.mag-10 {
        margin-right: 10px;
      }
      &.mag-0 {
        margin-right: 0px;
      }

      .img {
        width: 290px;
        height: 290px;
      }
      .list-hot-item-name {
        padding-top: 24px;
        font-size: 22px;
        height: 30px;
        text-align: center;
      }

      .list-hot-item-desc {
        padding-top: 5px;
        font-size: 16px;
        // height: 22px;
        color: #666;
        text-align: center;
      }

      .list-hot-item-price {
        margin-top: 20px;
        margin-bottom: 20px;
        display: flex;
        justify-content: center;
        border-radius: 18px;
        height: 36px;
        line-height: 36px;
        width: 130px;
        color: #fff;
        background-color: #bf2727;
      }
    }
  }
</style>